home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club (Business) 1997 July / Software of the Month Club - Business (Volume 239) (July 1997).iso / pc / code / d.dxr / 00010_Harp CODE.ls < prev    next >
Encoding:
Text File  |  1996-02-15  |  3.3 KB  |  95 lines

  1. global HARP, TIGO, HORN, DRUM, CHIME, BASS, sPALETTE, gObjects, gOBJECTSD, gWorld, gPuppetlines, sQTCharSprite, gNextEnvLetter, gMIDIPlayTRUE, gInitalized, noteObjs, windowsMIDIXObj, xNAVXOBJ, xCURXOBJ, gCPU, gFileSep, gRootPath, gHDpath, gXobjs, gXOBJPath, gCDpath, gCDName
  2.  
  3. on makeHarpChaotic
  4.   set HOBJ to getaProp(gObjects, #HARP)
  5.   AddObjects([#HarpToChoasAnim])
  6.   ChangeSpecialState(#HARP, #Chaotic)
  7.   eraseRecording(#HARP)
  8. end
  9.  
  10. on harpString RefNum
  11.   set startMouseH to the mouseH
  12.   set startMouseV to the mouseV
  13.   set OBj to getaProp(gObjects, RefNum)
  14.   set SpriteNum to getaProp(OBj, #SpriteNum)
  15.   set StringNum to getaProp(OBj, #StringNum)
  16.   set acastnumL to getaProp(getaProp(OBj, #cast), #left)
  17.   set acastnumR to getaProp(getaProp(OBj, #cast), #right)
  18.   set Dummy to getaProp(gObjects, #HarpDumbString)
  19.   set DumbNum to getaProp(Dummy, #SpriteNum)
  20.   set lastMouseH to startMouseH
  21.   set lastMouseV to startMouseV
  22.   set startcast to getaProp(getaProp(OBj, #cast), getaProp(OBj, #DisplayState))
  23.   if the castNum of sprite SpriteNum = acastnumL then
  24.     set startLeft to the left of sprite SpriteNum
  25.     set startTop to the top of sprite SpriteNum
  26.     set startRight to the right of sprite SpriteNum
  27.     set startBottom to the bottom of sprite SpriteNum
  28.   else
  29.     set startRight to the left of sprite SpriteNum
  30.     set startTop to the top of sprite SpriteNum
  31.     set startLeft to the right of sprite SpriteNum
  32.     set startBottom to the bottom of sprite SpriteNum
  33.   end if
  34.   repeat while the mouseDown
  35.     set mH to the mouseH
  36.     set mV to the mouseV
  37.     if (mH = lastMouseH) and (mV = lastMouseV) then
  38.       next repeat
  39.     end if
  40.     if StringNum <> 1 then
  41.       set OffsetH to mH - startMouseH
  42.       set OffsetV to mV - startMouseV
  43.       if OffsetH > 20 then
  44.         set mH to startMouseH + 20
  45.       else
  46.         if OffsetH < -20 then
  47.           set mH to startMouseH - 20
  48.         end if
  49.       end if
  50.       if OffsetV > 20 then
  51.         set mV to startMouseV + 20
  52.       else
  53.         if OffsetV < -20 then
  54.           set mV to startMouseV - 20
  55.         end if
  56.       end if
  57.     end if
  58.     set lastMouseH to mH
  59.     set lastMouseV to mV
  60.     if ((mH > startLeft) and (mV > startTop)) or ((mH < startLeft) and (mV < startTop)) then
  61.       set the castNum of sprite SpriteNum to acastnumL
  62.     else
  63.       set the castNum of sprite SpriteNum to acastnumR
  64.     end if
  65.     spriteBox(SpriteNum, startLeft, startTop, mH, mV)
  66.     if ((startRight > mH) and (startBottom > mV)) or ((startRight < mH) and (startBottom < mV)) then
  67.       set the castNum of sprite DumbNum to acastnumL
  68.     else
  69.       set the castNum of sprite DumbNum to acastnumR
  70.     end if
  71.     spriteBox(DumbNum, mH, mV, startRight, startBottom)
  72.     CursorandUpdate()
  73.   end repeat
  74.   set halfTone to indexedNoteInInstrumentScale(HARP, 13 - StringNum)
  75.   set note to 60 + halfTone - 1
  76.   noteOn(#HARP, note, 127)
  77.   set noteOnTime to the ticks
  78.   spriteBox(DumbNum, -2000, -2000, -50, -50)
  79.   set the castNum of sprite SpriteNum to startcast
  80.   spriteBox(SpriteNum, startLeft, startTop, startRight, startBottom)
  81.   updateStage()
  82.   repeat while the ticks < (noteOnTime + 90)
  83.     CursorandUpdate()
  84.   end repeat
  85.   noteOff(#HARP, note)
  86.   if (StringNum = 1) and ((mH > 500) or (mH < 50)) then
  87.     makeHarpChaotic()
  88.   end if
  89. end
  90.  
  91. on playChaoticHarp OBJref
  92.   set OBj to getaProp(gObjects, OBJref)
  93.   PlayNoteFromHitMap(#HARP)
  94. end
  95.